package com.siecom.transport;

import android.bluetooth.BluetoothSocket;
import android.hardware.usb.UsbAccessory;

import com.siecom.tool.LogUtil;

import org.reactivestreams.Subscriber;

import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.Scheduler;


/**
 * Created by zhq on 2016/6/17.
 */
public class SiecomDevice {

    private static Distribution distribution = new Distribution();


    public static void initServer(Observer subscriber, Scheduler scheduler){
        Observable<BluetoothSocket> observable =  distribution.init();
        observable.observeOn(scheduler).subscribe(subscriber);
    }
    public static void startListen(ConnectStatusCallback callback){
        distribution.startListen(callback);
    }

    public static boolean startSerial(){

       return distribution.initSerial();
    }

    public static boolean startInitUsb(UsbAccessory accessory){
        return distribution.initUSB(accessory);
    }
    public static void closeUsb(){
        distribution.closeUSBAccessory();
    }
    private static final String TAG = SiecomDevice.class.getSimpleName();
    public  static void closeBT(){
        LogUtil.e(TAG,"closeBT ----");
        distribution.closeBT();

    }

    public static void closeSerial(){

        distribution.closeSerial();
    }



}
